
(async function(){
    try {
        await interview(1)
        await interview(2)
        await interview(3)
        console.log('smile')
    } catch(err) {
        console.log('cry at ' + err.round + ' round');
    }
})()

function interview(round) {
    return new Promise((resolve, reject) => {
        setTimeout(() => {
            if (Math.random() > 0.2) {
                resolve('success')
            } else {
                let error = new Error('fail');
                error.round = round;
                reject(error)
            }
        }, 500);
    });
}
